<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="format-detection" content="telephone=no" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
	<script type="text/javascript" src="static/admin/js/jquery.min.js"></script>
	<script type="text/javascript" src="static/admin/js/rem.js"></script>
	<link rel="stylesheet" href="static/admin/css/index.css" />
	<link rel="stylesheet" href="static/admin/css/icon/iconfont.css" />
	<title>收银台</title>
</head>
<body>
	<div class="white">
	
		<div class="much">
			{$cashierinfo.money} 元
		</div>
		<p style="font-size:18px; text-align: center;line-height: 30px;">待付款</p>
		<div class="content">
			<div class="c-top">
			</div>
			<div class="c-bottom">
				<ul class="t-name">
					<li>小区</li>
					<li>金额</li>
					<li>业务类型</li>
					<li>付款单位</li>
					<li>联系电话</li>
				</ul>
				<ul class="t-much">
					<li>{$communityinfo.community_name}</li>
					<li>{$cashierinfo.money} 元</li>
					<li>{$cashierinfo.business_type}</li>
					<li>{$cashierinfo.company}</li>
					
					<li>{$cashierinfo.phone}</li>
				</ul>
			</div>
		</div>
	</div>
	<div class="footer">
		
		<a onclick="order('{$cashierinfo.id}','{$cashierinfo.money}')" href="javascript:;"><button>立即付款</button></a>
	</div>
	

	<script type="application/javascript">
		function order(id,pay_money){
			var url = '{:url("cashierpay")}'
			$.post(url, {id: id,pay_money: pay_money}, function(r){
				// console.log(r)
				// return
				if (r.order_no) {
					tradePay(r.order_no)
				}else{
					alert(r.info)
                    location.reload()
                    // window.location.href="{:url('admin/Order/orderindex')}";
				}
			})
		}

		// 由于js的载入是异步的，所以可以通过该方法，当AlipayJSBridgeReady事件发生后，再执行callback方法
		function ready(callback) {
			 if (window.AlipayJSBridge) {
				 callback && callback();
			 } else {
				 document.addEventListener('AlipayJSBridgeReady', callback, false);
			 }
		}
	
		function tradePay(tradeNO) {
			ready(function(){
				 // 通过传入交易号唤起快捷调用方式(注意tradeNO大小写严格)
				 AlipayJSBridge.call("tradePay", {
					  tradeNO: tradeNO
				 }, function (data) {
					 if ("9000" == data.resultCode) {

                         var url="{$notifyurl_alipay}";
						window.location.href=url;
					 }
				 });
			});
		}
	</script>
</body>

</html>